﻿using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Media;

namespace ThunderboltCustomControlLibrary;

public class PlaceholderTextBox:TextBox
{
	static PlaceholderTextBox()
	{
		DefaultStyleKeyProperty.OverrideMetadata(typeof(PlaceholderTextBox), new FrameworkPropertyMetadata(typeof(PlaceholderTextBox)));
	}

	[CategoryAttribute("Custom attribute"), DescriptionAttribute("Gets or sets the default text")]
	public string Placeholder
	{
		get { return (string)GetValue(PlaceholderProperty); }
		set { SetValue(PlaceholderProperty, value); }
	}
	[CategoryAttribute("Custom attribute"), DescriptionAttribute("Gets or sets the default text")]
	public static readonly DependencyProperty PlaceholderProperty = DependencyProperty.Register("Placeholder", typeof(string), typeof(PlaceholderTextBox));


	//图片
	public Geometry Icon
	{
		get { return (Geometry)GetValue(IconProperty); }
		set { SetValue(IconProperty, value); }
	}

	// Using a DependencyProperty as the backing store for Icon.  This enables animation, styling, binding, etc...
	public static readonly DependencyProperty IconProperty =
		DependencyProperty.Register("Icon", typeof(Geometry), typeof(PlaceholderTextBox));

	//图片尺寸
	public double IconSize
	{
		get { return (double)GetValue(IconSizeProperty); }
		set { SetValue(IconSizeProperty, value); }
	}

	// Using a DependencyProperty as the backing store for IconSize.  This enables animation, styling, binding, etc...
	public static readonly DependencyProperty IconSizeProperty =
		DependencyProperty.Register("IconSize", typeof(double), typeof(PlaceholderTextBox), new PropertyMetadata(25d));

	public Thickness IconMargin
	{
		get { return (Thickness)GetValue(IconMarginProperty); }
		set { SetValue(IconMarginProperty, value); }
	}

	// Using a DependencyProperty as the backing store for IconMargin.  This enables animation, styling, binding, etc...
	public static readonly DependencyProperty IconMarginProperty =
		DependencyProperty.Register("IconMargin", typeof(Thickness), typeof(PlaceholderTextBox));
	public Thickness PlaceholderMargin
	{
		get { return (Thickness)GetValue(PlaceholderMarginProperty); }
		set { SetValue(PlaceholderMarginProperty, value); }
	}

	// Using a DependencyProperty as the backing store for PlaceholderMargin.  This enables animation, styling, binding, etc...
	public static readonly DependencyProperty PlaceholderMarginProperty =
		DependencyProperty.Register("PlaceholderMargin", typeof(Thickness), typeof(PlaceholderTextBox));

	public override void OnApplyTemplate()
	{
		base.OnApplyTemplate();

	}
}